/*
 *  2016 国赛 路径之谜 DFS
 * */

#include <iostream>
#include <stack>

using namespace std;

const int N = 25;
int a[N], b[N];
int n;
const int dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
int vis[N][N];
stack<int> s;

bool check() {
    for (int i = 0; i < n; ++i) {
        if (a[i] || b[i]) {
            return false;
        }
    }
    return true;
}

void print() {
    stack<int>ans;
    while (!s.empty()) {
        ans.push(s.top());
        s.pop();
    }
    while (!ans.empty()) {
        cout << ans.top() << " ";
        ans.pop();
    }

}

bool dfs(int x, int y) {
    if (x == n - 1 && y == n - 1) {
        if (check()) {
            return true;
        }
        return false;
    }

    for (int i = 0; i < 4; ++i) {
        int xx = x + dir[i][0], yy = y + dir[i][1];
        if (xx < 0 || xx >= n || yy < 0 || yy >= n ||
            vis[xx][yy] || !a[xx] || !b[yy]) {
            continue;
        }

        s.push(xx + yy * n);
        vis[xx][yy] = 1;
        a[xx]--;
        b[yy]--;
        if (dfs(xx, yy)) {
            return true;
        }
        vis[xx][yy] = 0;
        a[xx]++;
        b[yy]++;
        s.pop();
    }
    return false;
}

int main() {

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }

    s.push(0);
    vis[0][0] = 1;
    a[0]--;
    b[0]--;
    bool res = dfs(0, 0);
    cout << res << endl;
    print();
    return 0;
}